home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Cream of the Crop 1
/
Cream of the Crop 1.iso
/
PROGRAM
/
ZSIM12.ARJ
/
PORTIO.ASM
< prev
next >
Wrap
Assembly Source File
|
1991-12-11
|
1KB
|
73 lines
PUBLIC PORT_IN,PORT_OUT,GET_RAND ; FAR Routinen
PortIOCode segment para 'CODE'
assume cs:PortIOCode,ds:nothing,es:nothing,ss:nothing
; die Routinen sind als FAR Routinen implementiert, da sie
; moeglicherweise vom Benutzer veraendert werden koennen. Dabei
; soll er aber moeglichst nichts von der inneren Struktur der anderen
; Module mitbekommen, so auch keine Segmentnamen
; !
; es durfen keine Register zerstoert werden !
; !
DummyOps equ 1
;
; AL:=port(DX)
;
PORT_IN proc far
if DummyOps
mov al,0ffh ; alles auf high
else
in al,dx ; wenn nicht dummy
endif
ret
PORT_IN endp
;
; port(DX):=AL
;
PORT_OUT proc far
if DummyOps
nop
else
out dx,al ; wenn nicht dummy
endif
ret
PORT_OUT endp
;
; AL:= "Zufallszahl" x, 0<=x<=127
;
GET_RAND proc far
push cx
push dx
mov al,ah
mov ah,2ch ; MsDos Get Time
int 21h
mov ah,al
mov al,ch
xor al,cl
xor al,dh
xor al,dl
and al,7fh
pop dx
pop cx
ret
GET_RAND endp
PortIOCode ends
end